home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 11156 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.2 KB

  1. Path: news.mindspring.com!usenet
  2. From: efried@mindspring.com (Eric Friedman)
  3. Newsgroups: comp.lang.c,comp.programming
  4. Subject: Re: Assertive or Defensive?
  5. Date: Fri, 22 Mar 1996 08:15:40 GMT
  6. Organization: MindSpring Enterprises
  7. Message-ID: <4itcs2$po3@B1FF.mindspring.com>
  8. References: <4ioggn$3sf@dazzle.east-tenn-st.edu>
  9. NNTP-Posting-Host: efried.mindspring.com
  10. X-Newsreader: Forte Free Agent 1.0.82
  11.  
  12. zebl1@bobcat.east-tenn-st.edu (Eric B. Lemings) wrote:
  13.  
  14. >For those readers who are familiar with the concept of defensive
  15. >programming, I for one would like to know under what conditions
  16. >should assertions be used and under what conditions should 
  17. >defensive code be used?  Both have somewhat similar intentions
  18. >but do not, I believe, have the same contexts.
  19.  
  20. IMHO, assertions should be used during development to help detect
  21. situations not expected in "real-life", but that can be encountered
  22. during the initial coding effort. Detecting null pointers would be an
  23. example. Defensive coding should certainly be used to detect bad input
  24. from users.
  25.  
  26. Use assertions to detect programming errors.
  27.  
  28. e
  29. -------------------------------------------------------
  30. Eric Friedman        Internet: efried@mindspring.com
  31.  
  32.